package fhjoanneum.itm11.antesk.simplehack;
import java.util.*;

public class Inventory
{
	// Members -----------------------------------------------------------
	private Vector<Item> inventory;
	
	// Constructor -------------------------------------------------------
	Inventory()
	{
		this.inventory = new Vector<Item>();
	}
	
	// Getters and setters -----------------------------------------------
	public Vector<Item> getInventory()
	{
		return this.inventory;
	}
	
	// Methods ===========================================================
	
	// Add item to inventory ---------------------------------------------
	public void addItem(Item item)
	{
		this.inventory.add(item);
		System.out.println(item.getName() + " has been added to your " +
				"inventory.");
	}
	
	// List inventory ----------------------------------------------------
	public void listInventory(Character character)
	{
		if(inventory.size() > 0)
		{
			System.out.println("Contents of " + character.getName() + 
					"'s backpack");
			
			for(int i = 0; i < inventory.size(); i++)
			{
				System.out.println("Slot " + i + ": " + getInventory().
						elementAt(i).getName() + " - " + 
						getInventory().elementAt(i).getDescription());
			}
		}
		else
		{
			System.out.println("Your inventory is empty.");
		}
	}
}
